package com.example.stu.controller;

import com.example.stu.entity.PageMessage;
import com.example.stu.entity.PageResult;
import com.example.stu.entity.Result;
import com.example.stu.pojo.StuMessage;
import com.example.stu.service.StuMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date: 2021/3/22
 * @Author: 黄先军
 * @Description:
 */
@RestController
@RequestMapping("/message")
public class StuMessageController {
    @Autowired
    private StuMessageService stuMessageService;

    /**
     * 带条件的分页查询
     * @param pageMessage
     * @return
     */
    @RequestMapping("findPage")
    public PageResult findPage(@RequestBody PageMessage pageMessage){
        return stuMessageService.findPage(pageMessage);
    }

    /**
     * 学生提交留言
     * @param stuMessage
     * @return
     */
    @RequestMapping("messageTiJiao")
    public Result messageTiJiao(@RequestBody StuMessage stuMessage){
        return stuMessageService.messageTiJiao(stuMessage);
    }

    /**
     * 查看问题详情
     * @param id
     * @return
     */
    @RequestMapping("findById")
    public Result findById(Integer id){
        return stuMessageService.findById(id);
    }

    /**
     * 解决问题
     * @param id
     * @return
     */
    @RequestMapping("remove")
    public Result remove(Integer id){
        return stuMessageService.remove(id);
    }


}
